package com.lin.chapter11;

import java.util.ArrayList;
import java.util.List;

public abstract class CarModel {
	private List<String> squence = new ArrayList<>();

	protected abstract void start();
	protected abstract void stop();
	protected abstract void alarm();
	protected abstract void engineBoom();

	final public void run(){
		for (String action : squence) {
			if (action.equalsIgnoreCase("start"))
				this.start();
			else if (action.equalsIgnoreCase("stop"))
				this.stop();
			else if (action.equalsIgnoreCase("alarm"))
				this.alarm();
			else if (action.equalsIgnoreCase("engine boom"))
				this.engineBoom();
		}
	}

	final public void setSquence(List<String> squence){
		this.squence = squence;
	}
}
